<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<%@include file="/common/taglibs.jsp" %>
<%@include file="/common/meta.jsp" %>
<% String oaLoginUrl = "http://localhost:8080/sfj-oa/main.jsp";%>
</head>
<title>登录</title>
<body>
<c:if test="${param.login_error == 'user_psw_error' || param.login_error == '1'}">
<script type="text/javascript">
	alert('用户名或密码错误,请重试！');
</script>
</c:if> 
<stc:ifNotLogin>
<form id="loginForm" action='${ctx}/j_security_check' method="post" onsubmit="return loginCheck();">
<table width="207" border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td><img src="${ctx}/ResRoot/images/01/pic_userlogin.gif" width="207" height="41" /></td>
 </tr>
</table>
<table width="207" border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td height="169" valign="top" background="${ctx}/ResRoot/images/01/login_2.gif"><br />
  <div id="msg_3" align="center">
   <table width="180" height="116" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
     <td width="60">用户名：</td>
     <td width="120">
       <input name="j_username" id="j_username" type="text" class="inputborder" style="width:120px"/>
     </td>
    </tr>
    <tr>
     <td>密&nbsp;&nbsp;&nbsp;&nbsp;码：</td>
     <td>
       <input  name="j_password" id="j_password" type="password" class="inputborder" style="width:120px"/>
     </td>
    </tr>
    <tr>
     <td height="52" colspan="2">
	  <div align="center">
	   <input type="submit" style="width:66px; border:0px; height:23px;background-image:url(${ctx}/ResRoot/images/01/btn_login.gif);" value="">
	  </div>
	 </td>
    </tr>
   </table>
   <table width="180" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
     <td height="31"><div align="center">忘记密码？ |&nbsp;&nbsp; 查看帮助</div></td>
    </tr>
   </table>
  </div>
  </td>
 </tr>
</table>
<table width="207" border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td><img src="${ctx}/ResRoot/images/01/login_3.gif" width="207" height="18" /></td>
 </tr>
</table>
</form>
<script type="text/javascript">
function loginCheck(){
	user = document.getElementById("j_username").value;
	pass = document.getElementById("j_password").value;
	if (user.length==0 ){
		alert("请输入用户名");
		return false;
	}
	if (pass.length==0 ){
		alert("请输入密码");
		return false;
	}
	return true;
}
</script>
</stc:ifNotLogin>
<stc:ifLogin>
<table width="207" border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td><img src="${ctx}/ResRoot/images/01/pic_userinfo.gif" width="207" height="41" /></td>
 </tr>
</table>
<table width="207" border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td height="169" valign="top" background="${ctx}/ResRoot/images/01/login_2.gif"><br />
  <div id="msg_3" align="center">
   <table width="180" height="116" border="0" align="center" cellpadding="0" cellspacing="0">
    <tr>
     <td>
     <div style="line-height: 25px; text-align: left;">
       <div style="font-size: 15px; font-weight:bold;">
                   尊敬的&nbsp;<font color="red">${user.loginId}</font>&nbsp;您好
       </div>
       <div>上次登录：<s:date name="user.lastLoginTime" format="yyyy-MM-dd HH:mm"/>&nbsp;</div>
       <div>当前时间：<span id= "Clock"></span>&nbsp;</div>
       <div>
                         共登录${user.loginTimes}次&nbsp;&nbsp;
         <a href="${ctx}/j_acegi_logout"><img src="${ctx}/images/icons/124.gif">&nbsp;我要离开</a>
        </div>
     </div>
     <div style="text-align: center; padding-top: 3px;">
     	<stc:role ifAnyGranted="ROLE_ADMIN">
     	<a href="${ctx}/pages/layout.jsp" target="_blank"><img src="${ctx}/ResRoot/images/01/btn_enterweb.gif"/></a>
     	</stc:role>
     	<img src="${ctx}/ResRoot/images/01/btn_enteroa.gif" style="cursor:pointer" onclick="goToOa()"/>
     </div>
     </td>
    </tr>
   </table>
  </div>
  </td>
 </tr>
</table>
<table width="207" border="0" cellspacing="0" cellpadding="0">
 <tr>
  <td><img src="${ctx}/ResRoot/images/01/login_3.gif" width="207" height="18" /></td>
 </tr>
</table>
<form id="oaLogin" action="<%=oaLoginUrl%>" method="post" target="_blank">
  <input type="text" name="username" id="username" value="" style="display:none;">
  <input type="text" name="password" id="password" value="" style="display:none;">
</form>

<script type="text/javascript">
//随机访问变量,为chrome准备的
querystr = 0;
function goToOa(){
	document.getElementById("username").value = encodeURI('${user.loginId}');
	document.getElementById("password").value = '${user.truePass}';
	document.getElementById("oaLogin").action = "<%=oaLoginUrl%>?redom=" + querystr++; 
	document.getElementById("oaLogin").submit();
}

//获取日期与时间
function tick() {
	var hours, minutes, seconds, ap;
	var intHours, intMinutes, intSeconds;
	var today;
	today = new Date();
	intHours = today.getHours();
	intMinutes = today.getMinutes();
	intSeconds = today.getSeconds();
	if (intHours == 0) {
		hours = "12:";
		ap = "Midnight";
	} else if (intHours < 12) { 
		hours = intHours+":";
		ap = "上午";
	} else if (intHours == 12) {
		hours = "12:";
		ap = "Noon";
	} else {
		hours = intHours + ":";
		ap = "下午";
	}
	intMinutes < 10?minutes = "0"+intMinutes+":":minutes = intMinutes+":";
	intSeconds < 10?seconds = "0"+intSeconds+" ":seconds = intSeconds+" ";
	timeString = hours+minutes+seconds+ap;
	Clock.innerHTML = timeString;
	window.setTimeout("tick();", 1000);
}
window.onload = tick;
</script>
</stc:ifLogin>
<script type="text/javascript">
function reLoadCaseInfos(){
	//parent.document.getElementById("casediv").style.display="";
	parent.frames['caseinfos'].location.reload();
}
reLoadCaseInfos();
</script>
</body>
</html>